package game;

/**
 *	@(#)MountainRange.java
 *
 *	The <code>MountainRange</code> class represents the connected hill
 *	hexfields on the game board. Once a resource is specified, all hexes
 *	of a mountain range will produce this resource to the end of the game.
 *
 *	@author Grzegorz Kobiela
 *	@version 1.0 2008/4/24
 */
public final class MountainRange
extends GameObject
{
	/** The hexfields belonging to this mountain range. */
	private java.util.ArrayList<Hexfield> hexfields;

	/** The type of resource that can be found here. */
	private game.resources.ResourceType type;

	/**
	 *	Creates a new <code>MountainRange</code> object.
	 *	The default resource type is null.
	 *	@param hexes the hexfields belonging to this mountain range
	 */
	public MountainRange(java.util.ArrayList<Hexfield> hexes) {
		hexfields = new java.util.ArrayList<Hexfield>();
		hexfields.addAll(hexes);
		type = null;
	}

	/**
	 *	Sets the resource type to the given value, but only if the
	 *	resource type has not been set, yet.
	 *	@param type the hill type
	 */
	public void setType(game.resources.ResourceType type) {
		if(this.type == null) this.type = type;
	}

	/**
	 *	Returns the resource type.
	 *	@return the resource type
	 */
	public game.resources.ResourceType getType() {
		return type;
	}

	/**
	 *	Returns true if the given hexfield is part of this mountain range.
	 *	@param hexfield the hexfield
	 *	@return true if the given hexfield is part of this mountain range
	 */
	public boolean contains(Hexfield hexfield) {
		return hexfields.contains(hexfield);
	}
}